#!/bin/bash

echo "🚀 开始执行抓取操作..."

# 等待服务器启动
sleep 5

echo "1. 检查服务器状态..."
curl -s "http://localhost:8080/health" || echo "服务器未响应"

echo -e "\n2. 查看当前数据状态..."
curl -s "http://localhost:8080/api/vehicles" | jq 'length' || echo "无法获取车辆数据"

echo -e "\n3. 执行全量抓取 (这可能需要几分钟)..."
curl -X POST "http://localhost:8080/api/scrape_all" --max-time 300

echo -e "\n4. 检查抓取后数据..."
curl -s "http://localhost:8080/api/vehicles" | jq 'length' || echo "无法获取车辆数据"

echo -e "\n✅ 抓取操作完成"
